package isp.apps.example.shoppingcart.action;

import com.opensymphony.xwork.ActionSupport;

import isp.apps.example.shoppingcart.persistence.OrderStatusDirectory;
import isp.apps.example.shoppingcart.persistence.factory.OrderStatusPersistenceFactory;

import java.util.List;

public class LoadOrderStatusAction extends ActionSupport
{

  private List validOrderStatuses;
  private List allOrderStatuses;
  private List maxValidStatus;
  private List minValidStatus;

  public LoadOrderStatusAction()
  {
  }

  public String execute()
  {
    OrderStatusDirectory orderStatusDir = OrderStatusPersistenceFactory.getOrderStatusDirectory();
    allOrderStatuses = orderStatusDir.getAllStatuses();
    validOrderStatuses = orderStatusDir.getValidStatuses();
    minValidStatus = orderStatusDir.getMinValidStatus();
    maxValidStatus = orderStatusDir.getMaxValidStatus();
    return SUCCESS;
  }

  public List getValidOrderStatuses()
  {
    return validOrderStatuses;
  }

  public List getAllOrderStatuses()
  {
    return allOrderStatuses;
  }

  public List getMaxValidStatus()
  {
    return maxValidStatus;
  }

  public List getMinValidStatus()
  {
    return minValidStatus;
  }
}
